package com.sanjiahantang.youjiaclient.module.pdf.models.impl;

import android.app.Activity;
import android.content.Context;

import com.sanjiahantang.youjiaclient.base.BaseBean;
import com.sanjiahantang.youjiaclient.base.CallBack;
import com.sanjiahantang.youjiaclient.config.ConfigValue;
import com.sanjiahantang.youjiaclient.http.BaseDelegate;
import com.sanjiahantang.youjiaclient.http.OkHttpClientManager;
import com.sanjiahantang.youjiaclient.module.goods.beans.GoodsListBean;
import com.sanjiahantang.youjiaclient.module.pdf.beans.PdfInfoBean;
import com.sanjiahantang.youjiaclient.module.pdf.models.IPDFModel;
import com.squareup.okhttp.Request;

import java.util.Map;

/**
 * Created by yan on 2017/12/25.
 */

public class PDFModel implements IPDFModel {

    @Override
    public void loadPdfInfo(final Activity context, Map<String, String> param, final CallBack<PdfInfoBean> callBack) {
        OkHttpClientManager.postAsyn(context, ConfigValue.API_URL + "/sign/donwnPdfUrl",
                param, new BaseDelegate.ResultCallback<PdfInfoBean>() {

                    @Override
                    public void onError(Request request, Object tag, Exception e) {
                        callBack.onFailure(e.getMessage());
                    }

                    @Override
                    public void onResponse(PdfInfoBean response, Object tag) {
                        callBack.onSuccess(response, context, tag);
                    }
                }, true);
    }
}
